import { User, UserPermission, UserRole } from '../interface'

export const permissions: UserPermission[] = [
    {
        key: 'rbac_permission',
        name: '权限管理',
        desc: '添加删除基础权限项',
        readonly: true,
    },
    {
        key: 'rbac_role',
        name: '角色管理',
        desc: '添加删除用户角色',
        readonly: true,
    },
    {
        key: 'rbac_user',
        name: '用户管理',
        desc: '用户列表添加删除用户',
        readonly: true,
    },
    {
        key: 'rbac_self',
        name: '个人中心',
        desc: '个人中心修改密码等',
        readonly: true,
    },
];

export const roles: UserRole[] = [
    {
        key: 'admin',
        name: '管理员',
        desc: '拥有所有权限',
        permissions: permissions.map(p => p.key),
        readonly: true,
    },
    {
        key: 'user',
        name: '普通用户',
        desc: '拥有部分权限',
        permissions: ['rbac_self'],
    },
];

export const users: User[] = [
    {
        username: 'admin',
        nickname: '管理员',
        password: '123456',
        roles: ['admin'],
        readonly: true,
    },
    {
        username: 'user',
        nickname: '普通用户',
        password: '123456',
        roles: ['user'],
    },
];
